package com.ithema.b2b.goodsprovider.controller;

import com.ithema.b2b.goodsprovider.dao.GoodsDao;
import model.Goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class GoodsController {
    @Autowired
    GoodsDao goodsDao;

    @GetMapping(value = "/getAllgoods")
    public List<Goods> getAllgoods() {
        return goodsDao.getAllgoods();
    }

    @GetMapping(value = "/getOnegoods")
    public List<Goods> getOnegoods(@RequestParam(value = "gname")String gname) {
        return goodsDao.getOnegoods(gname);
    }

    @GetMapping(value = "/getOnegid")
    public Goods getOnegid(@RequestParam(value = "gid")int gid) {
        return goodsDao.getOnegid(gid);
    }
}
